package com.czmh.etc.onlinepubsys.jy.utils;

import com.jiuyv.etc.etcb2bgateway.channelImport.dto.*;
import com.jiuyv.etc.etcb2bgateway.multimedia.dto.MultimediaDownloadReqDTO;
import com.jiuyv.etc.etcb2bgateway.multimedia.dto.MultimediaDownloadRespDTO;
import com.jiuyv.etc.etcb2bgateway.multimedia.dto.MultimediaFileUploadReqDTO;
import com.jiuyv.etc.etcb2bgateway.multimedia.dto.MultimediaFileUploadRespDTO;

import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @since 2019.06.03 9:35
 */
public enum TradeEnum {
    VehicleVerify("ChannelImport",
            "VehicleVerify",
            "3.3车牌信息验证",
            VehicleVerifyReqDTO.class,
            VehicleVerifyRespDTO.class
    ),

    OrderApplication("ChannelImport", "OrderApplication",
            "3.4订单申请",
            OrderApplicationReqDTO.class,
            OrderApplicationRespDTO.class
    ),

    OrderModify("ChannelImport", "OrderModify",
            "3.5订单修改",
            OrderModifyReqDTO.class,
            OrderModifyRespDTO.class
    ),
    OrderMediaModify("ChannelImport", "OrderMediaModify",
            "3.6多媒体文件上传或重新上传",
            OrderMediaModifyReqDTO.class,
            OrderMediaModifyRespDTO.class
    ),
    OrderPayChannelSignModify("ChannelImport", "OrderPayChannelSignModify",
            "3.7支付渠道订单补签约",
            OrderPayChannelSignModifyReqDTO.class,
            OrderPayChannelSignModifyRespDTO.class
    ),
    OrderCancel("ChannelImport", "OrderCancel",
            "3.8订单申请撤销",
            OrderCancelReqDTO.class,
            OrderCancelRespDTO.class
    ),
    PayChannelSigning("ChannelImport", "PayChannelSigning",
            "3.9支付渠道签约",
            PayChannelSigningReqDTO.class,
            PayChannelSigningRespDTO.class
    ),
    PayChannelRelease("ChannelImport", "PayChannelRelease",
            "3.10支付渠道申请解约",
            PayChannelReleaseReqDTO.class,
            PayChannelReleaseRespDTO.class
    ),
    PayChannelReleaseInquire("ChannelImport", "PayChannelReleaseInquire",
            "3.11支付渠道申请解约查询",
            PayChannelReleaseInquireReqDTO.class,
            PayChannelReleaseInquireRespDTO.class
    ),

    OrderStatusInquire("ChannelImport", "OrderStatusInquire",
            "3.12申请订单状态查询",
            OrderStatusInquireReqDTO.class,
            OrderStatusInquireRespDTO.class
    ),
    OrderInquire("ChannelImport", "OrderInquire",
            "3.13申请订单查询",
            OrderInquireReqDTO.class,
            OrderInquireRespDTO.class
    ),
    BlacklistSynchronize("ChannelImport", "BlacklistSynchronize",
            "3.14黑名单同步",
            BlacklistSynchronizeReqDTO.class,
            BlacklistSynchronizeRespDTO.class
    ),

    MultimediaFileUpload("Multimedia", "MultimediaFileUpload",
            "5.2文件上传",
            MultimediaFileUploadReqDTO.class,
            MultimediaFileUploadRespDTO.class
    ),
    MultimediaDownload("Multimedia", "MultimediaDownload",
            "5.3多媒体下载",
            MultimediaDownloadReqDTO.class,
            MultimediaDownloadRespDTO.class
    );

    public String module;
    public String path;
    public String transCode;
    public String comment;
    public Class reqClassType;
    public Class respClassType;

    private static final Map<String, TradeEnum> ENUM_MAP = new ConcurrentHashMap<>();

    static {
        Arrays.stream(TradeEnum.values())
                .forEach(
                        Enum -> ENUM_MAP.put(Enum.module + "_" + Enum.path, Enum)
                );
    }

    TradeEnum(String module, String path, String comment,
              Class reqClassType, Class respClassType) {
        this.module = module;
        this.path = path;
        this.transCode = transCode;
        this.comment = comment;
        this.reqClassType = reqClassType;
        this.respClassType = respClassType;
    }

    public static TradeEnum searchEnum(String module, String path) {
        return ENUM_MAP.get(module + "_" + path);
    }

}
